package com.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.base.MyBaseAdapter;
import com.bean.QueryBean;

import java.util.List;

import demo.zdc.com.myapplication.R;

/**
 * Created by mhysa on 2017/1/20.
 * 结算人
 */
public class JieSuanRenAdapter extends MyBaseAdapter {
     private Context context;
     private List<QueryBean.UserListBean> list;
    private final LayoutInflater inflater;

    public JieSuanRenAdapter(Context context , List<QueryBean.UserListBean> list){
        super(context,list);
        this.context = context;
        this.list = list;
        inflater = LayoutInflater.from(context);
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder viewHolder;
        if(convertView == null) {
            viewHolder = new ViewHolder();
            convertView =  inflater.inflate(R.layout.spnner_item,parent, false);
            viewHolder.textview = (TextView) convertView.findViewById(R.id.tv_spinner);
            convertView.setTag(viewHolder);
        } else {
            viewHolder = (ViewHolder) convertView.getTag();
        }

        viewHolder.textview.setText(list.get(position).getUser());
        return convertView;
    }

    public class ViewHolder{
        private TextView textview;
    }
}
